/*
 * @Author: your name
 * @Date: 2022-03-29 18:45:37
 * @LastEditTime: 2022-05-20 10:52:08
 * @LastEditors: QiuZongXi 897956138@qq.com
 * @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 * @FilePath: \vue2_cli\src\api\materialSettlement\materialProcurement.js
 */
//    1:物资结算 2:物资采购结算
import service from '@/utils/request'
// eslint-disable-next-line no-unused-vars
const { httpPostForm, httpPost, httpGet } = service
import { selectDataClient } from '@/utils/common'
const request = {
    //获取table页面列表
    getpaymentList (params) {
        return httpPost({
            url: '/materialsettle/purchaseSettlement/listByEntity',
            params
        })
    },
    //保存基本信息
    savejibenxinxi (params) {
        return httpPost({
            url: '/materialsettle/purchaseSettlement/create',
            params
        })
    },
    //冲红单
    chonghongdan (params) {
        return httpGet({
            url: '/materialsettle/purchaseSettlement/initRedBill',
            params
        })
    },
    //更新明细信息
    updatemingxi (params) {
        return httpPost({
            url: '/materialsettle/purchaseSettlement/updateList',
            params
        })
    },
    //更新服务费用
    updatefuwufeiyong (params) {
        return httpPost({
            url: '/materialsettle/purchaseSettlement/updateServiceFeeList',
            params
        })
    },
    //更新保证金 (暂扣 和 返还)
    updatebzj (params) {
        return httpPost({
            url: '/materialsettle/purchaseSettlement/updateMaterialsList',
            params
        })
    },
    //更改 基本信息
    updatajibenxinxi (params) {
        return httpPost({
            url: '/materialsettle/purchaseSettlement/update',
            params
        })
    },
    //删除采购结算
    shanchucgjs (params) {
        return httpGet({
            url: '/materialsettle/purchaseSettlement/delete',
            params
        })
    },
    //根据id 获取基本信息
    getjibenxixibyId (params) {
        return httpGet({
            url: '/materialsettle/purchaseSettlement/findById',
            params
        })
    },
    //根据id 获取明细
    getmingxibyId (params) {
        return httpGet({
            url: '/materialsettle/purchaseSettlement/getListById',
            params
        })
    },
    //根据id 获取 服务费用
    getfuwufeiyongbyId (params) {
        return httpGet({
            url: '/materialsettle/purchaseSettlement/getServiceFeeListById',
            params
        })
    },
    //根据 id 获取 保证金(暂扣保证金 和 返还 保证金)
    getbaozhenjinbyId (params) {
        return httpGet({
            url: '/materialsettle/purchaseSettlement/getReturnDepositDtlListById',
            params
        })
    },

    //获取加扣款明细
    getjqkList () {
        return httpPost({
            url: '/materialsettle/common/getPlusDeductionLsit'
        })
    },
    //获取结算明细
    getjsmx (params) {
        return httpPost({
            url: '/materialsettle/acceptance/listUnsettleMaterialByFilterForSelect',
            params
        })
    },
    // 获取剩余预付款金额
    getRemainingPrepaymentAmount (params) {
        return httpGet({
            url: '/materialsettle/supplierPrepaymentSettlement/getAdvancePaymentAmount',
            params
        })
    },
    // 获取截止上期末的累计结算金额
    getCurrentTotalAmount (params) {
        return httpGet({
            url: '/materialsettle/purchaseSettlement/getPreviousTotalAmount',
            params
        })
    },

    // 物资验收-服务费用:选择合同
    getContract (orgId, contracted) {
        return  selectDataClient({
            SelectServiceToken: '/subcontract/thirdParty/getForMaterialSettlement', // 客户端对应方法名
            IsSingleMode: true, // 是否单选 true 单选 false 多选
            SelectedIDs: [JSON.stringify(contracted)], // 已选中id(注意：是上一次已选中的id，不是要传的参数，如果第一次选，则传[]) // 这个是客户端给的,没有则为空
            InitParamsStr: JSON.stringify(orgId),    // 接口参数(name为模拟参数)
            Title: '选择合同' // 标题
        }).then(res => {
            return res[0]
        })
    },
    // 物资验收-服务费用:选择结算单位
    getBillingUnit (data, ids) {
        return selectDataClient({
            SelectServiceToken: 'GeneralSelectOuter', // 客户端对应方法名
            IsSingleMode: true, // 是否单选 true 单选 false 多选
            SelectedIDs: [ids], // 已选中id(注意：是上一次已选中的id，不是要传的参数，如果第一次选，则传[]) // 这个是客户端给的,没有则为空
            InitParamsStr: JSON.stringify(data),    // 接口参数(name为模拟参数)
            Title: '选择结算单位' // 标题
        }).then(res => {
            return res[0]
        })
    },
}

export default request
